<%@page import="com.xnx3.wangmarket.Authorization"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="/wm/common/head.jsp">
	<jsp:param name="title" value="set"/>
</jsp:include>
<script src="https://res.zvo.cn/kefu/kefu.js"></script>

<script>
//客服对话相关
var isSend = false;	//weifasong
function sendMessage(){
	if(kefu.socket.socket.readyState != 1){
		//socket 还没打开
		return;
	}
	
	if(!isSend){
		kefu.chat.sendTextMessage("hello,我是一条系统自动发送的模拟消息，让您看下离线消息是怎么给您发送的。");
		parent.msg.close();	//关闭发送中提示
		parent.msg.alert('系统已经向您发一条消息，让您体验一下离线消息是怎么在微信里显示的。<br/>回到微信的消息列表看一下吧');
		isSend = true;
	}
}

//一打开页面就加载
wm.post('/kefu/chat/config/getNetConfig.json',{},function(data){
	if(data.result != '1'){
		msg.alert('加载 kefu.properties 配置出错：'+data.info);
	}else {
		//成功
		kefu.api.domain = data.api;
		kefu.socket.url = data.socket;
		
		//kefu.js 初始化
		kefu.init();
		
		kefu.ui.chat.entry('<%=request.getParameter("chatid") %>');
		
		parent.msg.loading('系统正在向您发一条消息，让您体验一下离线消息是怎么在微信里显示的');
		setInterval("sendMessage()",1000);
	}
});

</script>

<jsp:include page="/wm/common/foot.jsp"></jsp:include>